package com.googlecode.skald.client.comm;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsonUtils;

/**
 * A JavasScript overlay object for the JSON object that forms the header
 * of a response from the game server. 
 * See {@link com.googlecode.skald.client.Server#handleResponse(String)}.
 * <p>
 * Currently supported fields in the single JSON header object include:
 * <ul>
 * <li>[none]
 * </ul>
 * 
 * @author Zach Tomaszewski
 */
public final class ResponseHeader extends JavaScriptObject {

  protected ResponseHeader() {    
  }
    
  /**
   * Constructs an overlay for the given json object taken from a server 
   * response body.  
   * 
   * @throws IllegalArgumentException  If string cannot be parsed into a 
   * valid JSON object or array.
   */
  public static ResponseHeader parse(String json) {
    return JsonUtils.safeEval(json);
  }
  
}

